package com.example.chat.model;

import com.example.chat.constant.StaticConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description
 * @Date 2022/11/16 11:43
 * @Author pq
 */
@Entity
@Data
@Table(name = "VDOA019_ASSETS")
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@DynamicInsert
@DynamicUpdate
@NoArgsConstructor
public class Assets extends BaseEntity  implements Serializable {

    private static final long serialVersionUID = -3891771603082322830L;

    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "DOA019_ID", length = 50)
    private Integer id;

    /**
     * 设备编号
     */
    @Column(name = "DOA019_DEVICE_ID")
    private String deviceId;

    /**
     * 资产所属地区
     */
    @Column(name = "DOA019_REGION_ID")
    private String regionId;

    @ManyToOne(targetEntity = Region.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "DOA019_REGION_ID", updatable = false, insertable = false)
    private Region region;

    /**
     * 资产购买时间
     */
    @Column(name = "DOA019_PURCHASE_TIME")
    @Temporal(TemporalType.DATE)
    @JsonFormat(pattern = StaticConstant.DATE_FORMAT, timezone = StaticConstant.GMT8)
    private Date purchaseTime;

    /**
     * 购买公司主体
     */
    @Column(name = "DOA019_COMPANY_ID")
    private String companyId;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "DOA019_COMPANY_ID", insertable = false, updatable = false)
    private Company company;

    /**
     * 设备类型
     */
    @Column(name = "DOA019_EQUIPMENT_TYPE_ID")
    private String equipMentTypeId;

    @Column(name = "DOA019_EQUIP_MENT_TYPE_NAME")
    private String equipMentTypeName;

    @JoinColumn(name = "DOA019_EQUIPMENT_TYPE_ID", insertable = false, updatable = false)
    @ManyToOne(fetch = FetchType.LAZY, targetEntity = EquipMentType.class)
    private EquipMentType equipMentType;

    /**
     * 品牌型号
     */
    @Column(name = "DOA019_BRAND_MODEL_NUMBER")
    private String brandModelNumber;

    /**
     * 使用年限
     */
    @Column(name = "DOA019_USE_PERIOD")
    private Integer usePeriod;

    /**
     * 设备状态
     */
    @Column(name = "DOA019_ASSETS_STATUS")
    @Enumerated(value = EnumType.STRING)
    private AssetsStatus assetsStatus;

    @Column(name = "DOA019_ASSETS_STATUS_INDEX")
    private Integer assetsStatusIndex;

    /**
     * 是否已删除
     */
    @Column(name = "DOA019_DELETED")
    private Boolean deleted = false;

    @Column(name = "DOA019_ASSETS_APPROVAL_STATUS")
    @Enumerated(EnumType.STRING)
    private AssetsApprovalStatus assetsApprovalStatus = AssetsApprovalStatus.NONE;

    @Column(name = "DOA019_POST_SCRIPT")
    private String postscript;

    /**
     * 是否发送了通知
     */
    @Column(name = "DOA019_SEND_RESULT")
    private Boolean sendResult = false;
}
